package com.xjm.controller.frontend;

import com.xjm.model.dto.MainPageInfoDTO;
import com.xjm.model.dto.Result;
import com.xjm.service.combine.HeadLineShopCategoryCombineService;
import lombok.Getter;
import org.myspringframework.core.annotation.Controller;
import org.myspringframework.core.inject.annotation.Autowired;
import org.myspringframework.mvc.annotation.RequestMapping;
import org.myspringframework.mvc.type.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author jaymin<br>
 * <h4>处理首页请求</h4>
 * 2020/11/7 22:43
 */
@Controller
@Getter
@RequestMapping("/main")
public class MainPageController {
    @Autowired(value = "HeadLineShopCategoryCombineServiceImpl")
    private HeadLineShopCategoryCombineService headLineShopCategoryCombineService;

    /**
     * 返回首页信息
     * @param request
     * @param response
     * @return
     */
    public Result<MainPageInfoDTO> getMainPageInfo(HttpServletRequest request, HttpServletResponse response) {
        return headLineShopCategoryCombineService.getMainPageInfo();
    }

    @RequestMapping(value = "/error",method = RequestMethod.GET)
    public void throwException(){
        throw new RuntimeException("我是异常");
    }


}
